<%@ taglib prefix="s" uri="/struts-tags"%>
<%@taglib prefix="sj" uri="/struts-jquery-tags"%>
<%@taglib prefix="sjg" uri="/struts-jquery-grid-tags"%>
<style>
.norm-navbar-inner {
	height: 30px;
	padding-top: 0px;
}
</style>
<script src="/cargloss/struts/utils.js" type="text/javascript">
	
</script>
<script src="/cargloss/struts/xhtml/validation.js"
	type="text/javascript">
	
</script>
<script>
	$(function() {
		$("#insert").hide();
		$("#delete").hide();
		$("#update").hide();
		$("#back").hide();
	});

	$.subscribe('clearTarget', function(event, data) {
		$("#resultTarget").html("");
	});

	$.subscribe('buttonClick', function(event, data) {

		$("#debug").html(data.id + " " + data.id.indexOf("confirm"));
		if (data.id.indexOf("edit") >= 0) {
			$("#insert").hide();
			$("#add").hide();
			$("#update").show();
			$("#back").show();

		}

		if (data.id.indexOf("delete") >= 0) {
			$("#insert").hide();
			$("#add").show();
			$("#delete").hide();
			$("#update").hide();
			$("#back").hide();

		}

		if (data.id.indexOf("back") >= 0) {
			$("#insert").hide();
			$("#add").show();
			$("#delete").hide();
			$("#update").hide();
			$("#back").hide();
		}

		if (data.id.indexOf("confirm") >= 0) {
			$("#insert").hide();
			$("#add").hide();
			$("#update").hide();
			$("#delete").show();
			$("#back").show();
		}

		if (data.id.indexOf("add") >= 0) {
			$("#insert").show();
			$("#add").hide();
			$("#back").show();
		}

		if (data.id.indexOf("insert") >= 0) {
			$("#insert").hide();
			$("#update").hide();
			$("#add").show();
			$("#back").hide();
		}
		if (data.id.indexOf("update") >= 0) {
			$("#insert").hide();
			$("#update").hide();
			$("#add").show();
			$("#back").hide();
		}
	});
</script>
<div id="debug"></div>
<s:url id="urlCari" action="modul/event/list/cari" escapeAmp="false">
	<s:param name="_search">true</s:param>
	<s:param name="rows">10</s:param>
	<s:param name="page">1</s:param>
	<s:param name="sord">asc</s:param>
	<s:param name="sidx">id</s:param>
	<s:param name="searchOper">like</s:param>
	<s:param name="searchField">nama</s:param>
</s:url>

<s:url id="urlAdd" action="modul/event/page/add" />
<s:url id="urlInsert" action="modul/event/crud/insert" />
<s:url id="urlDel" action="modul/event/crud/delete" />
<s:url id="urlUpdate" action="modul/event/crud/update" />





<s:url id="urlPaging" action="modul/event/list/paging" escapeAmp="false">
	<s:param name="_search">true</s:param>
	<s:param name="rows">5</s:param>
	<s:param name="page">1</s:param>
	<s:param name="sord">asc</s:param>
	<s:param name="sidx">id</s:param>
</s:url>


<sj:div href="%{urlPaging}" reloadTopics="reloadPaging"
	id="resultTarget"></sj:div>


<hr />
<div class="row-fluid">
	<div class="span2 offset10" id="insertButtonDiv">
		<sj:a id="insert" href="%{urlInsert}" cssClass="btn"
			formIds="insertForm" onBeforeTopics="clearTarget"
			targets="resultTarget" onSuccessTopics="reloadPaging"
			onClickTopics="buttonClick" button="true" validate="true">Insert</sj:a>

		<sj:a id="add" href="%{urlAdd}" onBeforeTopics="clearTarget"
			targets="resultTarget" button="true" cssClass="btn"
			onClickTopics="buttonClick">Add Event
		</sj:a>

		<sj:a id="update" href="%{urlUpdate}" cssClass="btn"
			formIds="updateForm" onBeforeTopics="clearTarget"
			targets="resultTarget" onSuccessTopics="reloadPaging"
			onClickTopics="buttonClick">Update</sj:a>

		<sj:a id="back" indicator="indicator" button="true" cssClass="btn"
			onClickTopics="clearTarget,reloadPaging,buttonClick">Back
		</sj:a>

		<sj:a id="delete" href="%{urlDel}" targets="resultTarget"
			onBeforeTopics="clearTarget" formIds="deleteForm" cssClass="btn"
			onClickTopics="buttonClick" onSuccessTopics="reloadPaging">Delete Event
	</sj:a>
	</div>


</div>
